package operation;

import book.Book;
import book.BookList;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a1227
 * Date: 2022-10-04
 * Time: 12:00
 */
public class AddOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("增加书籍！");
        System.out.println("请输入书名:>");
        String name = scanner.nextLine();
        System.out.println("请输入作者:>");
        String author = scanner.nextLine();
        System.out.println("请输入类型:>");
        String type = scanner.nextLine();
        System.out.println("请输入价格:>");
        int price = scanner.nextInt();

        Book book = new Book(name,author,type,price);
        bookList.setBook(bookList.getSize(),book);
        System.out.println("增加成功！");
        bookList.setSize(bookList.getSize() + 1);
    }
}
